#!/bin/sh
# lib/roundtripper
# 
# Part of the CCNx distribution.
#
# Copyright (C) 2009 Palo Alto Research Center, Inc.
#
# This work is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by the
# Free Software Foundation.
# This work is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.
#
# This tries decoding all the ccnb files in the current directory
# into XML and then back into binary, comparing the result to the original.
D=`dirname "$0"`/
test -x "$D"ccn_ccnbtoxml || D=''
for i in *.ccnb; do "$D"ccn_ccnbtoxml "$i" | "$D"ccn_xmltoccnb - | cmp - "$i" || exit 1; done
for i in *.ccnb; do "$D"ccn_ccnbtoxml "$i" | xmlwf || exit 1; done
